import appShare, {
	closeShare
} from "./share.js"
import {
		commonGet
	} from "@/api/commonapi.js"
export default {
	onBackPress(e) {
		closeShare()
	},
	methods: {
		onShareType(type) {
			let _this=this
			let shareData = {
				shareUrl: "http://app.artisanchn.com/",
				shareTitle: this.shareTitle,
				shareContent: this.shareContent,
				shareImg: this.shareImg, 
			};
			if (type == 3) {
				shareData.mediaUrl = ".mp3";
				shareData.type = type;
			} else if (type == 4) {
				shareData.mediaUrl = ".mp4";
				shareData.type = type;
			} else if (type == 5) {
				// 小程序必须是在微信开放平台与App绑定的才行
				shareData.appId = "";
				shareData.appPath = "pages/home/home";
				shareData.appWebUrl = "https://kemean.com/";
				shareData.type = type;
			}
		 appShare(shareData, function (res) {
				console.log("分享成功回调", res);

				if (_this.$store.state.token) {
					let query = {
						ak: _this.$store.state.token,
						cmd: 'mShare_add_proc', 
						para: {
							"skeyid": _this.id,
							"spageid": _this.spageid, 
							"title": _this.shareTitle,
							"img":_this.img,
							"_creatememid":_this.creatememid
						}
					}
					commonGet(query, (result) => {
						console.log(result)
					})
				}
				
				closeShare()
			});
		}
	}
}
